<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .div1 {
            float: left;
            height: 100px;
            background-color: red;
        }
        .div2 {
            float: left;
            height: 100px;
            background-color: green;
        }
        .div3 {
            float: left;
            height: 100px;
            background-color: blue;
        }
        .div4 {
            float: left;
            height: 100px;
            background-color: yellow;
        }
        @media only screen and (min-width: 0px) and (max-width: 500px) {
            .small1 {
                width: 25%;
            }
            .small2 {
                width: 50%;
            }
            .small3 {
                width: 75%;
            }
            .small4 {
                width: 100%;
            }
        }
        @media only screen and (min-width: 500px) and (max-width: 1000px) {
            .big1 {
                width: 25%;
            }
            .big2 {
                width: 50%;
            }
            .big3 {
                width: 75%;
            }
            .big4 {
                width: 100%;
            }
        }
    </style>
</head>
<body>
    <div class="div1 small4 big4"></div>
    <div class="div2 small4 big2"></div>
    <div class="div3 small4 big1"></div>
    <div class="div4 small4 big1"></div>
</body>
</html>